package com.java.test.system.gametypemanage.entity;

import lombok.Data;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

@Data
public class GameTypeEntity implements RowMapper<GameTypeEntity> {
    private Long id;//id
    private String gName;//游戏类型名称
    private String remarks;//备注
    private String operation;//添加操作人
    private LocalDateTime createTime;//创建时间
    private String modify;//修改操作人
    private LocalDateTime modifyTime;//创建时间
    private int status;//状态
    private int sort;//排序


    @Override
    public GameTypeEntity mapRow(ResultSet resultSet, int i) throws SQLException {
        GameTypeEntity info = new GameTypeEntity();

        info.setId(resultSet.getLong("id"));
        info.setGName(resultSet.getString("gName"));
        info.setRemarks(resultSet.getString("remarks"));
        info.setOperation(resultSet.getString("operation"));
        info.setCreateTime(resultSet.getTimestamp("createTime") == null ? null : resultSet.getTimestamp("createTime").toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime());
        info.setModify(resultSet.getString("modify"));
        info.setModifyTime(resultSet.getTimestamp("modifyTime") == null ? null : resultSet.getTimestamp("modifyTime").toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime());
        info.setStatus(resultSet.getInt("status"));
        info.setSort(resultSet.getInt("sort"));
        return info;
    }
}
